package sol.leetcode;

import java.util.Arrays;

/**
 * H-Index
 */
public class Issue274 {
    public int hIndex(int[] citations) {

        Arrays.sort(citations);

        int h = 0;
        while (h < citations.length && citations[citations.length - 1 - h] > h)
            h++;

        return h;
    }

    public static void main(String[] args) {
        int[] citations = {};
        System.out.println(new Issue274().hIndex(citations));
    }
}
